/**
 * Definition for a binary tree node.

 */
class TreeNode14 {
  val: number
  left: TreeNode14 | null
  right: TreeNode14 | null
  constructor(val?: number, left?: TreeNode14 | null, right?: TreeNode14 | null) {
    this.val = (val===undefined ? 0 : val)
    this.left = (left===undefined ? null : left)
    this.right = (right===undefined ? null : right)
  }
}
// @ts-ignore
function isSameTree(p: TreeNode14 | null, q: TreeNode14 | null): boolean {
    if (p === null && q === null) return true
    if (p === null) return false;
    if (q === null) return false;
    if (p.val == q.val) {
      return isSameTree(p.left, q.left) && isSameTree(p.right, q.right)
    }else return  false
};
